<%@page import="java.util.Map"%>
<%@page import="java.util.HashMap"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加新员工</title>
</head>
<body>

	<form:form action="${pageContext.request.contextPath }/emp"
		method="post" modelAttribute="employee"  enctype="multipart/form-data" >
		<c:if test="${employee.id ==null }">
    LastName:<form:input path="lastName" />
			<form:errors path="lastName"></form:errors>
		</c:if>
		<c:if test="${employee.id!=null }">
			<form:hidden path="id" />
			<input type="hidden" name="_method" value="PUT" />
			 LastName:<form:input path="lastName" disabled="true" />
		</c:if>

		<br>
Email:<form:input path="email" />
		<form:errors path="email"></form:errors>
		<br>
		<%
			Map<String, String> genders = new HashMap<String, String>();
				genders.put("1", "男");
				genders.put("0", "女");
				request.setAttribute("genders", genders);
		%>
        Gender:
        <form:radiobuttons path="gender" items="${genders }"
			delimiter="<br>" />
		<br>
        
        Department:<form:select path="department.id"
			items="${departments }" itemLabel="departmentName" itemValue="id"></form:select>
		<br>
        Birth:<form:input path="birth" />
		<form:errors path="birth"></form:errors>
		<br>
        Salary:<form:input path="salary" />
		<form:errors path="salary"></form:errors>
		
		
		Portrait File:<input type="file" name="file"/>
		
		
		<input type="submit" value="Submit" />
		
		
	</form:form>
	
	<br><br>
	
	

</body>
</html>